package com.asion.gankapp.presenter;

import com.asion.gankapp.entrys.BaseMeituEntry;
import com.asion.gankapp.model.AllTypeModel;
import com.asion.gankapp.model.MeituModel;
import com.asion.gankapp.view.BaseView;

/**
 * Created by asion on 16-10-6.
 */

public class MeituPresenter implements BasePresenter {
    private MeituModel meituModel;
    private BaseView baseView;

    public MeituPresenter(BaseView baseView) {
        this.baseView = baseView;
        meituModel = new MeituModel();
        baseView.setPresenter(this);
    }

    public void getDatas(int id,int page){
        meituModel.getDatas(id, page, new AllTypeModel.OnGetEntryDatas() {
            @Override
            public void onGetEntrySuccess(Object object) {
                baseView.showMeituSuccess(((BaseMeituEntry) object));
            }

            @Override
            public void onGetEntryError(String string) {
                baseView.showMeituError(string);
            }
        });
    }

    @Override
    public void start(Object type, int page) {
        getDatas(((int) type),page);
    }
}
